package org.leviatan.dataharbour.jclient.local;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeSet;
import java.util.Vector;

import org.leviatan.dataharbour.core.admin.DataHarbourAdminService;
import org.leviatan.dataharbour.core.admin.impl.DataHarbourAdminServiceImpl;
import org.leviatan.dataharbour.core.model.DataSource;
import org.leviatan.dataharbour.core.model.HarbourRequest;
import org.leviatan.dataharbour.core.model.PersistenceResource;
import org.leviatan.dataharbour.jclient.DataHarbourServiceProxy;

public class LocalServiceProxy extends DataHarbourServiceProxy {
	
	private DataHarbourAdminService service = null;
	
	@Override
	public String getNewUniqueId() {
		return this.service.getNewUniqueId();
	}

	public LocalServiceProxy() {
		this.service = DataHarbourAdminServiceImpl.getInstance();
	}

	@Override
	public Map getAllUnpersistedHarbourRequests() {
		return this.service.getAllUnpersistedHarbourRequests();
	}

	@Override
	public Collection getSendersUnpersistedHarbourRequests(String senderId) {
		return this.service.getSendersUnpersistedHarbourRequests(senderId);
	}

	@Override
	public HarbourRequest getUnpersistedHarbourRequest(String reqId) {
		return this.service.getUnpersistedHarbourRequest(reqId);
	}

	@Override
	public void loadConfiguration(String filePath) {
		this.service.loadConfiguration(filePath);
	}

	@Override
	public void loadModels() {
		this.service.loadModels();
	}

	@Override
	public void loadRegisterMappings() {
		this.service.loadRegisterMappings();
	}

	@Override
	public void removeUnpersistedHarbourRequest(String reqId) {
		this.service.removeUnpersistedHarbourRequest(reqId);
	}

	@Override
	public void saveModels() {
		this.service.saveModels();
	}

	@Override
	public void saveRegister() {
		this.service.saveRegister();
	}

	@Override
	public Map getAllDataSources() {
		return this.service.getAllDataSources();
	}

	@Override
	public DataSource getDataSource(String id) {
		return this.service.getDataSource(id);
	}

	@Override
	public void removeDataSource(String id) {
		this.service.removeDataSource(id);
	}

	public Vector getDataSourcesDefs(String dataSourceId) {
		return service.getDataSourcesDefs(dataSourceId);
	}

	public TreeSet<String> getDataSourcesPersistenceResourceKeys(String dataSourceId) {
		return service.getDataSourcesPersistenceResourceKeys(dataSourceId);
	}

	public void removeDefFromDataSource(String dataSourceId, String defId) {
		this.service.removeDefFromDataSource(dataSourceId, defId);		
	}

	public void removePersistenceResourceFromDataSource(String dataSourceId, String persResId) {
		this.service.removePersistenceResourceFromDataSource(dataSourceId, persResId);
		
	}

	public void addDefToDataSource(String dsId, String defId) {
		this.service.addDefToDataSource(dsId, defId);	
	}

	public void addPersistenceResourceToDataSource(String dsId, String perResId) {
		this.service.addPersistenceResourceToDataSource(dsId, perResId);
	}

	public Collection getAllVirtualStructures() {
		return this.service.getAllVirtualStructures();
	}

	public void saveDataSource2DefinitionsMappings() {
		this.service.saveDataSource2DefinitionsMappings();
		
	}

	public void saveDataSource2PersistenceResourceMappings() {
		this.service.saveDataSource2PersistenceResourceMappings();
	}

	public HashMap getAllPersistenceResources() {
		return service.getAllPersistenceResources();
	}

	public TreeSet<String> getDataSourcesPersistenceResources(String dataSourceId) {
		return this.service.getDataSourcesPersistenceResources(dataSourceId);
	}

	public String addDataSource(DataSource ds) {
		return this.service.addDataSource(ds);
	}

	public String createDataSource(String name) {
		return this.service.createDataSource(name);
	}

	@Override
	public void saveDataSources() {
		this.service.saveDataSources();
	}

	@Override
	public void savePersistenceResources() {
		this.service.savePersistenceResources();
	}

	@Override
	public void saveUnpersistedHarbourRequests() {
		this.service.saveUnpersistedHarbourRequests();
	}

	public PersistenceResource getPersistenceResource(String persResId) {
		return this.service.getPersistenceResource(persResId);
	}

	public void removePersistenceResource(String persResId) {
		this.service.removePersistenceResource(persResId);
	}

	@Override
	public void updateHibernatePersistenceResource(String id, String name, String hibConf) {
		this.service.updateHibernatePersistenceResource(id, name, hibConf);
	}

	@Override
	public String createHibernatePersistenceResource(String name, String confString) {
		return this.service.createHibernatePersistenceResource(name, confString);
	}

	@Override
	public String createPersistenceResource(String name, String type) {
		return this.service.createPersistenceResource(name, type);
	}

	@Override
	public void updatePersistenceResource(String id, String name) {
		this.service.updatePersistenceResource(id, name);
		
	}

	@Override
	public void updateDataSource(String id, String name) {
		this.service.updateDataSource(id, name);
	}

}
